package in.wptrafficanalyzer.navigationdrawerdemo;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class RiverFragment extends Fragment{
	
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
	
		// Retrieving the currently selected item number
		int position = getArguments().getInt("position");
		
		// List of rivers
		String[] rivers = getResources().getStringArray(R.array.items);
		
		View v;
		
		switch (position) {
		case 0:
			v = inflater.inflate(R.layout.notice, container, false);
			break;
		case 1:
			v = inflater.inflate(R.layout.about_us, container, false);
			break;
		case 2:
			v = inflater.inflate(R.layout.sports_team, container, false);
			break;
		case 3:
			v = inflater.inflate(R.layout.welfare, container, false);
			break;
		case 4:
			v = inflater.inflate(R.layout.sponsor, container, false);
			break;
		case 5:
			v = inflater.inflate(R.layout.usefullinks, container, false);
			break;
		default:
			// Creating view correspoding to the fragment
			v = inflater.inflate(R.layout.fragment_layout, container, false);
			
			// Getting reference to the TextView of the Fragment
			TextView tv = (TextView) v.findViewById(R.id.tv_content);
			
			// Setting currently selected river name in the TextView
			tv.setText(rivers[position]);	
		}
		
		// Updating the action bar title
		getActivity().getActionBar().setTitle(rivers[position]);
		
		return v;
	}
}